package org.example.exp3.exam6;

import java.util.*;

public class Thermosensor {

   private List<AlarmListener> alarmListeners = new ArrayList<>();
   
   public void attach(AlarmListener alarmListener) {
      alarmListeners.add(alarmListener);
   }
   
   public void trigger() {
      for (AlarmListener alarmListener : alarmListeners) {
         alarmListener.alarm();
      }
   }
}